home *** CD-ROM | disk | FTP | other *** search
/ PC World 2004 December / PCWorld_2004-12_cd.bin / software / temacd / tiny / tf6pro-6[1].0.140.exe / Tiny Firewall Pro 6.0.msi / ar_index.js < prev    next >
Encoding:
JavaScript  |  2004-07-20  |  16.7 KB  |  609 lines

  1. /*//////////////////////////////////////////////////////////////////////
  2. filename:         ar_index.js
  3. copyright(c):     2002, 2003 Tiny Software Inc (http://www.tinysoftware.com)
  4. author:         Martin Navratil (mnavratil@tinysoftware.com)
  5. product:         Tiny Personal Firewall 5.x
  6. description:     javascript code used in ar_index.html
  7. ///////////////////////////////////////////////////////////////////////*/
  8.  
  9. // ar_index.js
  10.         var label;
  11.         var isNew = 0;
  12.         var bIsDll;
  13.         var     LT_CHECKSUM = 0,
  14.             LT_PATH = 1,
  15.             LT_NAME = 2,
  16.             LT_CHECKSUM_AND_PATH = 3,
  17.             LT_CHECKSUM_AND_NAME = 4,
  18.             AR_ALLOW = 1,
  19.             AR_PREVENT = 0,
  20.             AR_ASKUSER = 2,
  21.             AL_IGNORE = 0,
  22.             AL_MONITOR = 1,
  23.             AL_ALERT = 2;
  24.  
  25.         var ERR_LABEL_EXISTS="Label already exists - will not be saved.",
  26.             TXT_MSG1 = "Label will be enrolled into ",
  27.             TXT_MSG2 = " database",
  28.             TXT_MSG3 = " since ",
  29.             TXT_MSG4 = " is a ",
  30.             TXT_MSG5 = " group.",
  31.             TXT_USER = "user",
  32.             TXT_MASTER = "master";
  33.  
  34.         var bGroupIsServer = 0, bGroupIsClient = 0;
  35.         var curGr = null, arrGroupSelect;
  36.  
  37.         function OnLoad()
  38.         {
  39.             if (iContext == 0 && iManaged == 0)
  40.                 Users.innerHTML = '<img src="ico-usr.gif" width="33" height="28" border="0" alt="" align="absmiddle">' + GetUsersHtml();
  41.             ARXWaitForCreate();
  42.         }
  43.         function Refresh()
  44.         {
  45.             location.reload();
  46.         }
  47.         function ARXWaitForCreate()
  48.         {
  49.             if (CfgARX.controlWindow == 0)
  50.                     setTimeout("ARXWaitForCreate()", 30);
  51.             else
  52.                 FinishARXInit();
  53.         }
  54.         function FinishARXInit()
  55.         {
  56.             var div = document.all["div_warning"];
  57.             if (iContext)
  58.             {
  59.                 div.className = "expanded";
  60.             }
  61.             CfgARX.bgColor = "#E7EFF7";
  62.             if (ClientAppParser == null)
  63.                 ClientAppParser = new ActiveXObject('XMLSecDB.APPParser.1');
  64.             CfgARX.Init(ClientAppParser, ServerAppParser, iManaged, iContext);
  65.             var RegRoot = "";
  66.             if (!iContext)
  67.                 window.external.RegistryRoot;
  68.             CfgARX.IsAdmin = bIsAdmin;
  69.             CfgARX.SetRegistryRoot(RegRoot);
  70.             divMain.className="expanded";
  71.         }
  72.         function WaitForCreate()
  73.         {
  74.             if (form.EditChks.controlWindow == 0)
  75.                     setTimeout("WaitForCreate()", 30);
  76.             else
  77.                 FinishEditInit();
  78.         }
  79.         function Edit()
  80.         {
  81.             label = CfgARX.CurrentLabel;
  82.             bIsDll = CfgARX.isLabelDll;
  83.             if (label==null)
  84.                 alert("No application is selected");
  85.             else
  86.             {
  87.                 var clLabelList = null;
  88.                 if (ClientAppParser != null)
  89.                     clLabelList = bIsDll ? ClientAppParser.DllLabelList : ClientAppParser.LabelList;
  90.                 if (iManaged || !bIsAdmin)
  91.                 {
  92.                     try
  93.                     {
  94. // label can be edited only in client database
  95.                         clLabelList.Get(label.LabelID);
  96.                         form.save.disabled = false;
  97.                         form.savenew.disabled = false;
  98.                     }
  99.                     catch(e)
  100.                     {
  101.                         if (!iManaged && !bIsAdmin  ||  iManaged && !iContext)
  102.                         {
  103.                             form.save.disabled = true;
  104.                             form.savenew.disabled = true;
  105.                         }
  106.                     }
  107.                 }
  108.                 divMain.className="collapsed";
  109.                 divEdit.className="expanded";
  110.                 div_edit_warning.className="expanded";
  111.                 divChecksum.className="expanded";
  112.                 DivParserSelect.className="collapsed";
  113.                 isNew = 0;
  114.                 WaitForCreate();
  115.             }
  116.         }
  117.         function Enroll(bDll)
  118.         {
  119.             if (bDll || bDll == 0)
  120.                 bIsDll = bDll;
  121.             else
  122.                 bIsDll = CfgARX.isLabelDll;
  123.             try
  124.             {
  125.                 label = bIsDll ? ClientAppParser.DllLabelList.CreateDllLabel() : ClientAppParser.LabelList.CreateLabel();
  126.             } catch (e)
  127.             {
  128.                 try
  129.                 {
  130.                     label = bIsDll ? ServerAppParser.DllLabelList.CreateDllLabel() : ServerAppParser.LabelList.CreateLabel();
  131.                 } catch (e)
  132.                 {
  133.                     alert("Failed to create a new label");
  134.                     return;
  135.                 }
  136.             }
  137.             divMain.className="collapsed";
  138.             divEdit.className="expanded";
  139.             div_edit_warning.className="expanded";
  140.             divChecksum.className="expanded";
  141.             isNew = 1;
  142.             var srGroups = null, clGroups = null;
  143.             if (ServerAppParser != null && !(iManaged && !iContext))
  144.                 srGroups = bIsDll ? ServerAppParser.DllGroupList : ServerAppParser.AppGroupList;
  145.             if (ClientAppParser != null )
  146.                 clGroups = bIsDll ? ClientAppParser.DllGroupList : ClientAppParser.AppGroupList;
  147.             GetLabelIsServerOrClient(srGroups, clGroups);
  148.             var collSrGroups = null, collClGroups = null;
  149.             if (srGroups != null && !(iManaged && !iContext))
  150.                 collSrGroups = new Enumerator(srGroups);
  151.             if (clGroups != null && !iContext)
  152.                 collClGroups = new Enumerator(clGroups);
  153.             DivParserSelect.innerHTML = GetParserSelectCombo();
  154.             DivGroupSelect.innerHTML = GetGroupSelect( collSrGroups, collClGroups );
  155.             DivParserSelect.className="expanded";
  156.             WaitForCreate();
  157.         }
  158.         function InitGroupSelectCombo()
  159.         {
  160.             if (ServerAppParser != null && !(iManaged && !iContext))
  161.                 srGroups = bIsDll ? ServerAppParser.DllGroupList : ServerAppParser.AppGroupList;
  162.             if (ClientAppParser != null )
  163.                 clGroups = bIsDll ? ClientAppParser.DllGroupList : ClientAppParser.AppGroupList;
  164.             if (srGroups != null && !(iManaged && !iContext))
  165.                 collSrGroups = new Enumerator(srGroups);
  166.             if (clGroups != null && !iContext)
  167.                 collClGroups = new Enumerator(clGroups);
  168.             DivGroupSelect.innerHTML = GetGroupSelect( collSrGroups, collClGroups );
  169.         }
  170.         function FinishEditInit()
  171.         {
  172.             // determine if app or dll
  173.             form.rad_typeapp[0].checked = !bIsDll;
  174.             form.rad_typeapp[1].checked = bIsDll;
  175.             form.EditChks.SetLabel(label);
  176.             form.EditChks.isDll = bIsDll;
  177.             if (bIsDll)
  178.                 form.EditChks.FileMask = "";
  179.             else
  180.                 form.EditChks.FileMask = "*.exe";                
  181.             form.Name.value=label.LabelID;
  182.             form.Description.value=label.Description;
  183.             form.Path.value = label.Path;
  184.             form.Filename.value = label.Path;
  185.             LoadType();
  186.             LoadICType();
  187.             SetIDEnable();
  188.         }
  189.         function Browse()
  190.         {
  191.             divMain.className="expanded";
  192.             divEdit.className="collapsed";
  193.             div_edit_warning.className="collapsed";
  194.             CfgARX.Refresh();
  195.         }
  196.         function SetIDEnable()
  197.         {
  198. //            if (isNew)
  199.                 form.Name.disabled = false;
  200. //            else
  201. //                form.Name.disabled = true;
  202.         }
  203.         function New(bDll)
  204.         {
  205.             var labellist;
  206.             if (bDll || bDll == 0)
  207.                 bIsDll = bDll;
  208.             if (ClientAppParser != null)
  209.             {
  210.                 labellist = bIsDll ? ClientAppParser.DllLabelList : ClientAppParser.LabelList;
  211.             }else
  212.             {
  213.                 labellist = bIsDll ? ServerAppParser.DllLabelList : ServerAppParser.LabelList;
  214.             }
  215.             label = bIsDll ? labellist.CreateDllLabel() : labellist.CreateLabel();
  216.             form.EditChks.SetLabel(label);
  217.             form.Name.value = "";
  218.             form.Description.value = "";
  219.             form.Type.value = 0;
  220.             form.Path.value = "";
  221.             // determine if app or dll
  222.             form.rad_typeapp[0].checked = !bIsDll;
  223.             form.rad_typeapp[1].checked = bIsDll;
  224.             ChangeType();
  225.             isNew = 1;
  226.             SetIDEnable();
  227.             var srGroups, clGroups;
  228.             if (ServerAppParser != null)
  229.                 srGroups = bIsDll ? ServerAppParser.DllGroupList : ServerAppParser.AppGroupList;
  230.             if (ClientAppParser != null)
  231.                 clGroups = bIsDll ? ClientAppParser.DllGroupList : ClientAppParser.AppGroupList;
  232.             curGr = null;
  233.             var collSrGroups = null, collClGroups = null;
  234.             if (srGroups != null)
  235.                 collSrGroups = new Enumerator(srGroups);
  236.             if (clGroups != null)
  237.                 collClGroups = new Enumerator(clGroups);
  238.             GetLabelIsServerOrClient(srGroups, clGroups);
  239.             DivParserSelect.innerHtml = GetParserSelectCombo();
  240.             DivParserSelect.className="expanded";
  241.             DivGroupSelect.innerHTML = GetGroupSelect(collSrGroups, collClGroups);
  242.         }
  243.  
  244.         function GetLabelIsServerOrClient(srGroups, clGroups)
  245.         {
  246.             if (iContext)
  247.             {
  248.                 bGroupIsClient = 0;
  249.                 bGroupIsServer = 1;
  250.             }
  251.             
  252.             var curGrLabel = CfgARX.curGroup;
  253.             bGroupIsClient = 0;
  254.             bGroupIsMaster = 0;
  255.             var curLList = null;
  256.             try
  257.             {
  258.                 curLList = CfgARX.CurrentLList;
  259.             }
  260.             catch (e)
  261.             {
  262.             }
  263.             if (!bIsAdmin)
  264.             {
  265.                 bGroupIsClient = 1;
  266.                 bGroupIsMaster = 0;
  267.             }
  268.             else
  269.             if (curLList == ClientAppParser.LabelList)
  270.                 bGroupIsClient = 1;
  271.             if (curLList == ServerAppParser.LabelList)
  272.                 bGroupIsServer = 1;
  273. /*            {
  274.                 try {
  275.                     if (srGroups != null)
  276.                         if ((curGr = srGroups.Get(curGrLabel)) != null)
  277.                             bGroupIsServer = 1;
  278.                 } catch(e) {}
  279.                 try {
  280.                     if (clGroups != null)
  281.                         if ((curGr = clGroups.Get(curGrLabel)) != null)
  282.                             bGroupIsClient = 1;
  283.                 } catch(e) {}
  284.             }
  285. */
  286.         }
  287.         
  288.         function GetGroupSelect(srGroups, clGroups)
  289.         {
  290.             var iClient_Master;
  291.             try {
  292.                 iClient_Master = parseInt(form.ParserSelect.selectedIndex);
  293.             } catch(e)
  294.             {
  295.                 // if element form.ParserSelect does not continue, we end up here
  296.                 if (iManaged)
  297.                     iClient_Master = iContext ? 0 : 1;
  298.                 else
  299.                     iClient_Master = bGroupIsClient;
  300.             }
  301.     // app.group selection            
  302.             var strout = '<P>Assign to application group: <SELECT id="GroupSelChange" ' +
  303.             'OnChange="OnGroupChange(this.value, GroupSelChange.selectedIndex);"><OPTION><None></OPTION>';
  304.             arrGroupSelect = new Array();        
  305.             arrGroupSelect[0]  = 0;
  306.             var arrLabelTypes = new Array();
  307.             var strGroupSelected = CfgARX.curGroup;
  308.             if (srGroups != null && iClient_Master == 0)
  309.                 strout += AddAllGroups(srGroups, arrLabelTypes, strGroupSelected);
  310.             while (arrGroupSelect.length - 1 < arrLabelTypes.length)
  311.                 arrGroupSelect[arrGroupSelect.length] = 1;
  312.             if (clGroups != null && iClient_Master == 1)
  313.                 strout += AddAllGroups(clGroups, arrLabelTypes, strGroupSelected);
  314.             while (arrGroupSelect.length - 1 < arrLabelTypes.length)
  315.                 arrGroupSelect[arrGroupSelect.length] = 2;
  316.             strout += '</SELECT></P>';
  317.             return strout;
  318.         }
  319.         
  320.         function GetParserSelectCombo()
  321.         {
  322.             var strout = "";
  323.             var curGrLabel = "";
  324.             if (curGr != null)
  325.                 curGrLabel = bIsDll ? curGr.DllGroupID : curGr.AppGroupID;
  326.  
  327. // master or client parser selection    
  328.             if (ServerAppParser == null || ClientAppParser == null || iManaged || (!bIsAdmin || bGroupIsServer != bGroupIsClient))
  329.             {
  330.                 strout += TXT_MSG1;
  331.                 if (ClientAppParser == null || bIsAdmin && bGroupIsServer)
  332.                     strout += TXT_MASTER;
  333.                 else
  334.                     strout += TXT_USER;
  335.                 strout += TXT_MSG2;
  336.                 if (curGrLabel != "")
  337.                 {
  338.                     strout += TXT_MSG3 + curGrLabel + TXT_MSG4;
  339.                     if (bIsAdmin && bGroupIsServer)
  340.                         strout += TXT_MASTER;
  341.                     else
  342.                         strout += TXT_USER;
  343.                     strout += TXT_MSG5;
  344.                 }
  345.             } else
  346.             {
  347.                 strout += 'Enroll this application into <SELECT id=ParserSelect onchange="OnParserSelectChange();">' +
  348.                 '<OPTION>common</OPTION>' +
  349.                 '<OPTION selected>user</OPTION>' +
  350.                 '</SELECT>database';
  351.             }
  352.             return strout;
  353.         }
  354.         function Remove()
  355.         {
  356.             label = CfgARX.CurrentLabel;
  357.             if (label==null)
  358.                 alert("No application is selected");
  359.             else
  360.             {
  361.                 CfgARX.Remove(-1);
  362.             }
  363.         }
  364.         function OnParserSelectChange()
  365.         {
  366.             switch (parseInt(form.ParserSelect.selectedIndex))
  367.             {
  368.             case 0:
  369.                 label = bIsDll ? ServerAppParser.DllLabelList.CreateDllLabel() : ServerAppParser.LabelList.CreateLabel();
  370.                 break;
  371.             case 1:
  372.                 label = bIsDll ? ClientAppParser.DllLabelList.CreateDllLabel() : ClientAppParser.LabelList.CreateLabel();
  373.                 break;
  374.             }
  375.             form.EditChks.SetLabel(label);
  376.             InitGroupSelectCombo();
  377.         }
  378.         function OnGroupChange(value, index)
  379.         {
  380.             var srAppGrList = null, clAppGrList = null;
  381.             if (ServerAppParser != null)
  382.                 srAppGrList = bIsDll ? ServerAppParser.DllGroupList : ServerAppParser.AppGroupList;
  383.             if (ClientAppParser != null)
  384.                 clAppGrList = bIsDll ? ClientAppParser.DllGroupList : ClientAppParser.AppGroupList;
  385.             if (value == "")
  386.             {
  387.                 curGr = null;
  388.                 bGroupIsServer = 0;
  389.                 bGroupIsClient = 0;
  390.             }
  391.             else
  392.             {
  393.                 switch (arrGroupSelect[index])
  394.                 {
  395.                 case 1:
  396.                     bGroupIsServer = 1;
  397.                     bGroupIsClient = 0;
  398.                     curGr = srAppGrList.Get(value);
  399.                     break;
  400.                 case 2:
  401.                     bGroupIsServer = 0;
  402.                     bGroupIsClient = 1;
  403.                     curGr = clAppGrList.Get(value);
  404.                     break;
  405.                 default:
  406.                     bGroupIsServer = 0;
  407.                     bGroupIsClient = 0;
  408.                     curGr = null;
  409.                 }
  410.             }
  411.             DivParserSelect.innerHTML = GetParserSelectCombo();
  412.         }
  413.         function reloadPathBrowser()
  414.         {
  415.             form.PathBrowse.outerHTML = '<INPUT id=PathBrowse value="" name=PathBrowse type=file onchange="Path.value=this.value;reloadPathBrowser();" STYLE="DISPLAY: none"></INPUT>';
  416.         }
  417.         
  418.         function Apply()
  419.         {
  420.             if (form.Name.value == "" || form.Name.value == null)
  421.             {
  422.                 alert("Application name must be specified");
  423.                 return 0;
  424.             }
  425.             var iClient_Master;
  426.             try {
  427.                 iClient_Master = parseInt(form.ParserSelect.selectedIndex);
  428.             } catch(e)
  429.             {
  430.                 // if element form.ParserSelect does not continue, we end up here
  431.                 if (iManaged)
  432.                     iClient_Master = iContext ? 0 : 1;
  433.                 else
  434.                     iClient_Master = bGroupIsClient;
  435.             }
  436.             var labellist, grouplist = null;
  437.             switch (iClient_Master)
  438.             {
  439.             case 0:    
  440.                 labellist = bIsDll ? ServerAppParser.DllLabelList : ServerAppParser.LabelList;
  441.                 if (bIsAdmin)
  442.                     grouplist = bIsDll ? ServerAppParser.DllGroupList : ServerAppParser.AppGroupList;
  443.                 break;
  444.             case 1:
  445.                 labellist = bIsDll ? ClientAppParser.DllLabelList : ClientAppParser.LabelList;
  446.                 grouplist = bIsDll ? ClientAppParser.DllGroupList : ClientAppParser.AppGroupList;
  447.                 break;
  448.             }
  449.  
  450.             try
  451.             {
  452.                 if (label.LabelID != form.Name.value)
  453.                     label.LabelID = form.Name.value;
  454.                 if (isNew == 1)
  455.                 {
  456.                     labellist.Insert(label);
  457.                 }
  458.             } catch(e)
  459.             {
  460.                 alert(ERR_LABEL_EXISTS);
  461.                 return 0;
  462.             }
  463.             label.Description = form.Description.value;
  464.  
  465.             var type = valueOfRadio(form.Type, 5);
  466.  
  467.             var ICtype = valueOfRadio(form.ICtype, 4);
  468.             if ((label.Type == LT_CHECKSUM_AND_NAME || label.Type == LT_CHECKSUM_AND_PATH) &&
  469.                 (type != LT_CHECKSUM_AND_NAME && type != LT_CHECKSUM_AND_PATH))
  470.                 SetICType(label, 0);
  471.  
  472.             label.Type = type;
  473.             if (type == LT_CHECKSUM || type == LT_CHECKSUM_AND_NAME  ||  type == LT_CHECKSUM_AND_PATH)
  474.             {
  475.                 form.EditChks.Apply();
  476.                 if (type != LT_CHECKSUM)
  477.                 {
  478.                     SetICType(label, ICtype);
  479.                 }
  480.             }
  481.  
  482.             if (type == LT_NAME  ||  type == LT_CHECKSUM_AND_NAME)
  483.                 label.Path = form.Filename.value;
  484.             else
  485.                 label.Path = form.Path.value;
  486.  
  487. // insert label into app group
  488.             if (curGr != null)
  489.             {
  490.                 var newLabelItem = bIsDll ? curGr.DllLabelList.CreateItem() : curGr.LabelList.CreateItem();
  491.                 newLabelItem.Content = label.LabelID;
  492.                 if (bIsDll)
  493.                     curGr.DllLabelList.Insert(newLabelItem);
  494.                 else
  495.                     curGr.LabelList.Insert(newLabelItem);
  496.             }
  497.             isNew = 0;
  498.             SetIDEnable();
  499.             return 1;
  500.         }
  501.         function valueOfRadio(r, n)
  502.         {
  503.             for (i = 0; i < n; i++) if (r[i].checked==true) 
  504.                 return parseInt(r[i].value);
  505.             return 0;
  506.         }
  507.         
  508.         function LoadType()
  509.         {
  510.             var type = label.Type;
  511.             form.Type[type].checked = true;
  512.             ChangeType();
  513.         }
  514.  
  515.         function ChangeType()
  516.         {
  517.             switch (valueOfRadio(form.Type, 5))
  518.             {
  519.             case 0:
  520.                 divPath.className="collapsed";
  521.                 divFilename.className="collapsed";
  522.                 divChecksum.className="expanded";
  523.                 form.ICtype.value = 0;
  524.                 SetICType(0);
  525.                 SetDisabled(form.ICtype, true, 4);
  526.                 break;
  527.             case 1:
  528.                 divPath.className="expanded";
  529.                 divFilename.className="collapsed";
  530.                 divChecksum.className="collapsed";
  531.                 form.ICtype.value = 0;
  532.                 SetDisabled(form.ICtype, true, 4);
  533.                 break;
  534.             case 2:
  535.                 divPath.className="collapsed";
  536.                 divFilename.className="expanded";
  537.                 divChecksum.className="collapsed";
  538.                 form.ICtype.value = 0;
  539.                 SetDisabled(form.ICtype, true, 4);
  540.                 break;
  541.             case 3:
  542.                 divPath.className="expanded";
  543.                 divFilename.className="collapsed";
  544.                 divChecksum.className="expanded";
  545.                 SetDisabled(form.ICtype, false, 4);
  546.                 break;
  547.             case 4:
  548.                 divPath.className="collapsed";
  549.                 divFilename.className="expanded";
  550.                 divChecksum.className="expanded";
  551.                 SetDisabled(form.ICtype, false, 4);
  552.                 break;
  553.             default:
  554.                 alert("Unknown type:");
  555.                 alert(valueOfRadio(Type, 4));
  556.             }
  557.         }                 
  558.         
  559.         function LoadICType()
  560.         {
  561.             var type = label.Type;
  562.             form.Type[type].checked = true;
  563.             ChangeType();
  564.         }
  565.  
  566.         function SetICType(labelTo, ICtype)
  567.         {
  568.             switch (ICtype)
  569.             {
  570.             case 0:
  571.                 labelTo.BGAccessResult = AR_ALLOW;
  572.                 labelTo.BGAuditLevel = AL_IGNORE;
  573.                 break;
  574.             case 1:
  575.                 labelTo.BGAccessResult = AR_ALLOW;
  576.                 labelTo.BGAuditLevel = AL_MONITOR;
  577.                 break;
  578.             case 2:
  579.                 labelTo.BGAccessResult = AR_ASKUSER;
  580.                 labelTo.BGAuditLevel = AL_MONITOR;
  581.                 break;
  582.             case 3:
  583.                 labelTo.BGAccessResult = AR_PREVENT;
  584.                 labelTo.BGAuditLevel = AL_MONITOR;
  585.                 break;
  586.             }
  587.         }
  588.         function SetDisabled(what, value, nofields)
  589.         {
  590.             for (i = 0; i < nofields; i++)
  591.                 what[i].disabled = value;
  592.         }
  593.  
  594.         function LoadICType()
  595.         {
  596.             var ar = label.BGAccessResult, al = label.BGAuditLevel;
  597.             var icType = 0;
  598.             if (ar == AR_ALLOW && al == AL_IGNORE)
  599.                 icType = 0;
  600.             else if (ar == AR_ALLOW && al == AL_MONITOR)
  601.                 icType = 1;
  602.             else if (ar == AR_ASKUSER && al == AL_MONITOR)
  603.                 icType = 2;
  604.             else if (ar == AR_PREVENT && al == AL_MONITOR)
  605.                 icType = 3;
  606.             form.ICtype[icType].checked = true;
  607.         }
  608.             
  609.